package com.jidian.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jidian.entity.Course;
import com.jidian.entity.StudentCourse;
import com.jidian.mapper.StudentCourseMapper;
import com.jidian.service.StudentCourseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 冯永龙、王艳玲、李斐
 * @since 2020-11-28
 */
@Service
public class StudentCourseServiceImpl extends ServiceImpl<StudentCourseMapper, StudentCourse> implements StudentCourseService {

    @Autowired
    private StudentCourseMapper studentCourseMapper;

    @Override
    public List<StudentCourse> getStudentCourse(Integer id) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("student_id",id);
        List<StudentCourse> list = studentCourseMapper.selectList(wrapper);
        List<Integer> list1 = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            list1.add(list.get(i).getCourseId());
        }
//        studentCourseMapper.selectCount();
        return list;
    }
}
